package com.lut.reservation.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 该配置类主要用来配置url到页面的配置。
 *
 * @author zyt
 */
@Configuration
public class ThymeleafConfig implements WebMvcConfigurer {

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/").setViewName("home/distribution");
    registry.addViewController("/back/login").setViewName("login/back");
    registry.addViewController("/home/login").setViewName("login/home");
    // 注册页
    registry.addViewController("/reg").setViewName("reg");
    // home页
    registry.addViewController("/back/index").setViewName("index");
    registry.addViewController("/distribution").setViewName("home/distribution");
    registry.addViewController("/dynamic").setViewName("home/dynamic");
    registry.addViewController("/introduction").setViewName("home/introduction");
    registry.addViewController("/personalCenter").setViewName("home/personalCenter");

    registry.addViewController("/user").setViewName("user/user");
    registry.addViewController("/user/add").setViewName("user/addOrUpdate");
    registry.addViewController("/user/update").setViewName("user/addOrUpdate");

    registry.addViewController("/room").setViewName("room/room");
    registry.addViewController("/room/add").setViewName("room/addOrUpdate");
    registry.addViewController("/room/update").setViewName("room/addOrUpdate");
    registry.addViewController("/room/comment").setViewName("room/comment/comment");
    registry.addViewController("/room/reservation").setViewName("room/reservation/reservation");
  }
}
